package com.lightkits.wms.controller;

import com.lightkits.wms.domain.deliveryorder.CancelDeliveryExecutor;
import com.lightkits.wms.domain.deliveryorder.ExeDeliveryOrderExecutor;
import com.lightkits.wms.domain.deliveryorder.QueryCustomerItemExecutor;
import com.lightkits.wms.domain.deliveryorder.QueryDeliveryByDoExecutor;
import com.lightkits.wms.domain.deliveryorder.QueryDeliveryExeExecute;
import com.lightkits.wms.domain.deliveryorder.QueryDeliveryOrderExecutor;
import com.lightkits.wms.domain.deliveryorder.QueryDeliveryTaskExecutor;
import com.lightkits.wms.domain.deliveryorder.SaveDeliveryOrderExecutor;
import com.lightkits.wms.dto.deliveryorder.CancelDeliveryRequestType;
import com.lightkits.wms.dto.deliveryorder.CancelDeliveryResponseType;
import com.lightkits.wms.dto.deliveryorder.ExecuteDeliveryRequestType;
import com.lightkits.wms.dto.deliveryorder.ExecuteDeliveryResponseType;
import com.lightkits.wms.dto.deliveryorder.QueryCustomerByDoRequestType;
import com.lightkits.wms.dto.deliveryorder.QueryCustomerByDoResponseType;
import com.lightkits.wms.dto.deliveryorder.QueryDeliverTaskRequestType;
import com.lightkits.wms.dto.deliveryorder.QueryDeliverTaskResponseType;
import com.lightkits.wms.dto.deliveryorder.QueryDeliveryByDoRequestType;
import com.lightkits.wms.dto.deliveryorder.QueryDeliveryByDoResponseType;
import com.lightkits.wms.dto.deliveryorder.QueryDeliveryExeRequestType;
import com.lightkits.wms.dto.deliveryorder.QueryDeliveryExeResponseType;
import com.lightkits.wms.dto.deliveryorder.QueryDeliveryOrderRequestType;
import com.lightkits.wms.dto.deliveryorder.QueryDeliveryOrderResponseType;
import com.lightkits.wms.dto.deliveryorder.SaveDeliveryOrderRequestType;
import com.lightkits.wms.dto.deliveryorder.SaveDeliveryOrderResponseType;
import io.choerodon.swagger.annotation.Permission;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * DeliveryOrderService
 *
 * @author jing.wei@hand-china.com
 * Created on 2019/2/21 13:12
 */
/*@SuppressWarnings("all")*/
/*@LightKitsContract(serviceName = "DeliveryOrderService", serviceNamespace = "center.soa.os-wms.com")*/
@RestController
@RequestMapping("/DeliveryOrderService")
public class DeliveryOrderController {


    @PostMapping(value = "/queryDeliverOrder")
    @Permission(permissionPublic = true)
    @ApiOperation(value = "/queryDeliverOrder")
    @ResponseBody
    public QueryDeliverTaskResponseType queryDeliverOrder(@RequestBody(required = false) QueryDeliverTaskRequestType request) {
        return queryDeliveryTaskExecutor.service(request);
    }

    @Autowired
    private QueryDeliveryTaskExecutor queryDeliveryTaskExecutor;

    @PostMapping(value = "/saveDeliveryOrder")
    @Permission(permissionPublic = true)
    @ApiOperation(value = "/saveDeliveryOrder")
    @ResponseBody
    public SaveDeliveryOrderResponseType saveDeliveryOrder(@RequestBody(required = false) SaveDeliveryOrderRequestType request) {
        return saveDeliveryOrderExecutor.service(request);
    }

    @Autowired
    private SaveDeliveryOrderExecutor saveDeliveryOrderExecutor;

    @PostMapping(value = "/exeDeliveryOrder")
    @Permission(permissionPublic = true)
    @ApiOperation(value = "/exeDeliveryOrder")
    @ResponseBody
    public ExecuteDeliveryResponseType exeDeliveryOrder(@RequestBody(required = false) ExecuteDeliveryRequestType request) {
        return exeDeliveryOrderExecutor.service(request);
    }

    @Autowired
    private ExeDeliveryOrderExecutor exeDeliveryOrderExecutor;

    @PostMapping(value = "/queryDeliverys")
    @Permission(permissionPublic = true)
    @ApiOperation(value = "/queryDeliverys")
    @ResponseBody
    public QueryDeliveryOrderResponseType queryDeliverys(@RequestBody(required = false) QueryDeliveryOrderRequestType request) {
        return queryDeliveryOrderExecutor.service(request);
    }

    @Autowired
    private QueryDeliveryOrderExecutor queryDeliveryOrderExecutor;

    @PostMapping(value = "/queryCustomerItem")
    @Permission(permissionPublic = true)
    @ApiOperation(value = "/queryCustomerItem")
    @ResponseBody
    public QueryCustomerByDoResponseType queryCustomerItem(@RequestBody(required = false) QueryCustomerByDoRequestType request) {
        return queryCustomerItemExecutor.service(request);
    }

    @Autowired
    private QueryCustomerItemExecutor queryCustomerItemExecutor;

    @PostMapping(value = "/cancelDelivery")
    @Permission(permissionPublic = true)
    @ApiOperation(value = "/cancelDelivery")
    @ResponseBody
    public CancelDeliveryResponseType cancelDelivery(@RequestBody(required = false) CancelDeliveryRequestType request) {
        return cancelDeliveryExecutor.service(request);
    }

    @Autowired
    private CancelDeliveryExecutor cancelDeliveryExecutor;

    @PostMapping(value = "/queryDeliveryByDo")
    @Permission(permissionPublic = true)
    @ApiOperation(value = "/queryDeliveryByDo")
    @ResponseBody
    public QueryDeliveryByDoResponseType queryDeliveryByDo(@RequestBody(required = false) QueryDeliveryByDoRequestType request) {
        return queryDeliveryByDoExecutor.service(request);
    }

    @Autowired
    private QueryDeliveryByDoExecutor queryDeliveryByDoExecutor;

    //TODO 处理失败 没有null executor

    @Autowired
    private QueryDeliveryExeExecute queryDeliveryExeExecute ;

    @PostMapping(value = "/queryDeliveryByParams")
    @Permission(permissionPublic = true)
    @ApiOperation(value = "/queryDeliveryByParams")
    @ResponseBody
    public QueryDeliveryExeResponseType queryDeliveryByParams(@RequestBody(required = false) QueryDeliveryExeRequestType request) {
        return queryDeliveryExeExecute.service(request);
    }
}
